<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Basic TextBox - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../demo.css">
    <script type="text/javascript" src="../../jquery.min.js"></script>
    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
    <div style="margin:20px 0;"></div>
    <div class="easyui-panel" title="New Topic" >
        <form id="addPatientFrom" method="post">
            <div style="margin-bottom:20px">           	
                <input class="easyui-textbox" name="diagnosticcard" id="diagnosticcard" style="width:40%" data-options="required:true,missingMessage:'请输入身份证号',label:'诊疗卡号:'">
            	---------
                <input class="easyui-textbox" name="name" id="name" style="width:40%" data-options="required:true,label:'姓名:'">
            </div>
            <div style="margin-bottom:20px">           	
                <input class="easyui-textbox" name="age" id="age" style="width:40%" data-options="required:true,label:'年龄:'">
            	---------
                <input class="easyui-textbox" name="phone" id="phone" style="width:40%" data-options="required:true,missingMessage:'请输入11位大陆手机号码',label:'手机号码:'">
            </div>
            <div style="margin-bottom:20px">           	
                <input class="easyui-textbox" name="country" id="country" style="width:40%" value="中国" data-options="required:true,missingMessage:'输入示例：中国',label:'国家:'">
            	---------
                <input class="easyui-textbox" name="nation" id="nation" style="width:40%"  data-options="required:true,missingMessage:'输入示例：汉族',label:'民族:'">
            </div>
            
            <div style="margin-bottom:20px">           	
                <select class="easyui-combobox" name="married" id="married" label="婚姻情况" style="width:20%"><option value="已婚">已婚</option><option value="未婚">未婚</option></select>
            	--------------
            	  <select class="easyui-combobox" name="sex" id="sex" label="性别" style="width:20%"><option value="男">男</option><option value="女">女</option></select>
            	--------
                <input class="easyui-textbox" name="address" id="address" style="width:30%" data-options="required:true,label:'家庭住址:'">
            </div>
            <div style="margin-bottom:20px">           	
                <input class="easyui-textbox" name="contacts" id="contacts" style="width:40%" data-options="required:true,missingMessage:'监护人或紧急联系人',label:'联系人:'">
            	---------
                <input class="easyui-textbox" name="cphone" id="cphone" style="width:40%" data-options="required:true,missingMessage:'请输入11位大陆手机号码',label:'联系人电话:'">
            </div>
            <div style="margin-bottom:20px">
                <input class="easyui-textbox" name="pastmedicalhistory" id="pastmedicalhistory" style="width:40%;height:60px" data-options="required:true,missingMessage:'若无既往病史，请填写无',label:'既往病史:',multiline:true">
				<input class="easyui-datebox" label="出生日期：" id="born" name="born" style="width:40%" data-options="formatter:myformatter,parser:myparser" style="width:100%;">
            </div>
            
        </form>
        <div style="text-align:center;padding:5px 0">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">Submit</a>
            
        </div>
    </div>
    <script>
        function submitForm(){
        	$("#addPatientFrom").form("submit", {
				
				url : 'patient/addpatient', 
				success : function(result) {
					var result = eval('(' + result + ')');
					if (result.success == 'true') {
						$.messager.show({
							title : "提示信息",
							msg : result.message
						})
						
					} else {
						$.messager.show({
							title : "提示信息",
							msg : result.message
						});
					}
				}
			});
        }
        function clearForm(){
            $('#addPatientFrom').form('clear');
        }
        function myformatter(date){
            var y = date.getFullYear();
            var m = date.getMonth()+1;
            var d = date.getDate();
            return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
        }
        function myparser(s){
            if (!s) return new Date();
            var ss = (s.split('-'));
            var y = parseInt(ss[0],10);
            var m = parseInt(ss[1],10);
            var d = parseInt(ss[2],10);
            if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
                return new Date(y,m-1,d);
            } else {
                return new Date();
            }
        }
    </script>
</body>
</html>